package com.wh.base.sys.role.controller.form;

import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;


@Data
@ApiOperation(value = "根据ids查询表单类")
public class IdsForm {

	@Pattern(regexp = "^\\d+([,]\\d+)*$", message = "id格式错误")
	@NotNull(message = "id不能为空")
	@Schema(description = "ids,多个id使用逗号分割")
	private String ids;
	
	public List<Long> idList(){
		String[] idArr = ids.split(",");
		List<Long> idList = new ArrayList<>();
		for(String id : idArr) {
			idList.add(Long.parseLong(id));
		}
		return idList;
	}

}
